/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ejb.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author simone
 */
@Entity
@Table(name = "Dipendente")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Dipendente.findAll", query = "SELECT d FROM Dipendente d"),
    @NamedQuery(name = "Dipendente.findByIdDipendente", query = "SELECT d FROM Dipendente d WHERE d.idDipendente = :idDipendente"),
    @NamedQuery(name = "Dipendente.findByName", query = "SELECT d FROM Dipendente d WHERE d.name = :name"),
    @NamedQuery(name = "Dipendente.findByNameAndPassword", query = "SELECT d FROM Dipendente d WHERE d.name = :name AND d.password = :psw")})
public class Dipendente implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_dipendente")
    private Integer idDipendente;
    @Size(max = 255)
    @Column(name = "name")
    private String name;
    @Size(max = 255)
    @Column(name = "password")
    private String password;

    public Dipendente() {
    }

    public Dipendente(Integer idDipendente) {
        this.idDipendente = idDipendente;
    }

    public Integer getIdDipendente() {
        return idDipendente;
    }

    public void setIdDipendente(Integer idDipendente) {
        this.idDipendente = idDipendente;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idDipendente != null ? idDipendente.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Dipendente)) {
            return false;
        }
        Dipendente other = (Dipendente) object;
        if ((this.idDipendente == null && other.idDipendente != null) || (this.idDipendente != null && !this.idDipendente.equals(other.idDipendente))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ejb.entities.Dipendente[ idDipendente=" + idDipendente + " ]";
    }
    
}
